import BaseService from './../base';

class BooksService extends BaseService {
  // 添加数据
  addBook = async (postData: any): Promise<string> => {
    return await this.post<string>('/books', postData);
  };

  // 删除数据
  deleteBookById = async (id: number): Promise<string> => {
    return await this.delete<string>('/books', id);
  };

  // 修改数据
  modifyBookById = async (params: any): Promise<string> => {
    return await this.patch<string>('/books', params.id, params);
  };

  // 查询列表
  bookList = async (params?: any): Promise<any> => {
    return await this.get('/books', params);
  };
}

export default new BooksService();
